<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>广东国防教育学会</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css" />
		<link rel="stylesheet" href="http://idangero.us/swiper/dist/css/swiper.min.css" />
		<link rel="stylesheet" href="/Public/Home/activity/css/style.css" />
	</head>
	<body>

	<nav class="bar bar-tab">
			<a class="tab-item open-indicator <?php if($active == 'home'): ?>active<?php endif; ?>"  href="/">
				<span class="icon icon-home"></span>
				<span class="tab-label">首页</span>
			</a>
			<a class="tab-item open-indicator" href="<?php echo U('Apply/apply');?>">
				<span class="icon iconfont icon-category"></span>
				<span class="tab-label">专家预约</span>
			</a>
			<a class="tab-item open-indicator" <?php if($active == 'user_company'): ?>active<?php endif; ?>" href="<?php echo U('UserCompany/index');?>">
				<span class="icon iconfont icon-huiyuan1"></span>
				<span class="tab-label">会员单位</span>
			</a>
			<a class="tab-item open-indicator <?php if($active == 'user'): ?>active<?php endif; ?>" href="<?php echo U('Users/index');?>">
				<span class="icon iconfont icon-account"></span>
				<span class="tab-label">我的</span>
			</a>
		</nav>	

	<body>
		<div class="bar bar-nav">
			<h1 class="title">我关注的</h1>
			<i class="icon icon-left" onclick="window.history.go(-1);"></i>
		</div>

		<div class="content">
			<div class="buttons-tab screen" style="margin-top:10px;">
				<a href="#follow_1" class="tab-link active button">活动</a>
				<a href="#follow_2" class="tab-link button">专家</a>
<!--				<a class="tab-link button">其他单位</a>
				<a class="tab-link button">基地</a>
				<a class="tab-link button">第三方服务</a>-->
			</div>
			
			<div class="tabs">
				<div id="follow_1" class="tab in_hot_box activity_1 active">
				<?php if($activity_show): ?><div style="text-align:center;"><a style="font-size:12px;border-bottom:1px solid #ddd;line-height:20px;display:inline-block;margin-bottom: 10px;">我关注了<?php echo ($collect_count); ?>个活动</a></div><?php endif; ?>
				<div id="collect_activity">
				<?php if(is_array($activity)): foreach($activity as $k=>$act): ?><div cl="123" class="card demo-card-header-pic user_order_card">
					  <div class="card-header" style="min-height: auto; padding: 0.15rem 0rem;margin-bottom: 10px;"><span><span class="iconfont icon-huiyuan1"></span> <?php echo ($act['sponsor']); ?></span>
					  <a class="confirm-ok" collect_id="<?php echo ($act['id']); ?>" href="javascript:void(0);" style="margin-right: 1.05rem;">
					  	取消关注
					  </a>
					  </div>
						<a href="<?php echo U('ActivityDetail/index',array('activity_id'=>$act['activity_id']));?>">
						<div valign="bottom" class="card-header color-white no-border no-padding">
							<img class='card-cover' src="<?php echo ($act['activity_img']); ?>" style="border-radius: 0;" alt="">
						</div>
						<div class="card-content">
							<div class="card-content-inner">
								<p class="hot_list_title"><?php echo ($act['activity_name']); ?></p>
								<p class="color-gray"><?php echo (date("Y-m-d",$act['start_time'])); ?> 至 <?php echo (date("Y-m-d",$act['end_time'])); ?></p>
								<p class="color-gray"><a style="font-size:12px;color: #999;"><?php echo ($act['area']); ?></a>
								<span><a class="button pull-right" style="display: inline-block;border-radius: inherit;font-size: 12px;font-weight: initial;">
								<?php if($today < $act['start_time']): ?>未开始
								<?php elseif(($today >= $act['start_time']) and ($today <= $act['end_time'])): ?>
								进行中
								<?php else: ?>
								已结束<?php endif; ?>
								</a></span>
								 </p>
							</div>
						</div>
						</a>
					</div><?php endforeach; endif; ?>	
				</div>
					<?php if($activity_show): ?><div class="infinite-scroll-preloader" id="activity_quan" style="display:none;">
						<div class="preloader"></div>
					 </div>
					<p onclick="ajax_sourch_submit();" class="activity_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
					<?php else: ?>
					<p id="load_more"> 暂无数据！</p><?php endif; ?>
				</div>
				
				<div id="follow_2" class="tab in_hot_box activity_1">
                                    <?php if($make_show): ?><div style="text-align:center;"><a style="font-size:12px;border-bottom:1px solid #ddd;line-height:20px;display:inline-block;margin-bottom: 10px;">我关注了<?php echo ($make_collect_count); ?>个预约</a></div><?php endif; ?>
                                    <div id="collect_make">
                                    <?php if(is_array($make)): foreach($make as $mm=>$make): ?><div cl="123" class="card demo-card-header-pic user_order_card">
					  <div class="card-header" style="min-height: auto; padding: 0.15rem 0rem;margin-bottom: 10px;">
                                              <span><span class="icon iconfont icon-favorite"></span>&nbsp;&nbsp;<?php echo ($make['user_name']); ?>&nbsp;&nbsp;
                                              [&nbsp;<?php switch($make['type']): case "1": ?>军事专家<?php break;?>
                                               <?php case "2": ?>国防专家<?php break;?>
                                               <?php case "3": ?>医学专家<?php break; endswitch;?>&nbsp;]
                                              </span>
					  <a class="cancel" collect_id="<?php echo ($make['id']); ?>" href="javascript:void(0);" style="margin-right: 1.05rem;">
					  	取消关注
					  </a>
					  </div>
						<a href="<?php echo U('Apply/expert_page',array('id'=>$make['apply_id']));?>">
						<div valign="bottom" class="card-header color-white no-border no-padding">
							<img class='card-cover' src="<?php echo ($make['headimgurl']); ?>" style="border-radius: 0;" alt="">
						</div>
						<div class="card-content">
							<div class="card-content-inner">
								<p class="color-gray"><a style="font-size:12px;color: #999;">联系电话：<?php echo ($make['phone']); ?></a></p>
                                                                <p class="color-gray"><?php echo ($make['signature']); ?></p>
								<p class="color-gray">收藏于：<?php echo (date("Y-m-d",$make['create_time'])); ?> <?php if($make['status_show'] == 1): ?><span><a class="button pull-right" style="display: inline-block;border-radius: inherit;font-size: 12px;font-weight: initial;">进行中</a></span><?php endif; ?></p>
							</div>
						</div>
						</a>
					</div><?php endforeach; endif; ?>
                                    </div>
                                    <?php if($make_show): ?><div class="infinite-scroll-preloader" id="make_quan" style="display:none;">
						<div class="preloader"></div>
					 </div>
					<p onclick="ajax_sourchMake_submit();" class="make_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
					<?php else: ?>
					<p id="load_more"> 暂无数据！</p><?php endif; ?>
				</div>
			</div>
		</div>


		<script type="text/javascript" src="http://g.alicdn.com/sj/lib/jquery/dist/jquery.min.js"></script>
		<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
		<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
		<script src="http://idangero.us/swiper/dist/js/swiper.min.js"></script>
		<script type="text/javascript" src="/Public/Home/activity/js/huodon.js" ></script>
		<script>
			
			var swiper = new Swiper('.swiper-container', {
				pagination: '.swiper-pagination',
				paginationClickable: true,
				loop:true,    
				grabCursor: true,
				autoplay: 3000
			});
			
			 /* $(document).on('click','.open-preloader', function () {
				 Zepto.showPreloader('加载中...')
				    setTimeout(function () {
				    	 Zepto.hidePreloader();
				    }, 2000); 
			 }); */
			 $(document).on('click','.open-indicator', function () {
				 Zepto.showIndicator();
			     setTimeout(function () {
			    	Zepto.hideIndicator();
			     }, 2000);
			  });
		</script>
		

	</body>

</html>

<script>
var  page = 1;
 /*** ajax 提交表单 查询订单列表结果*/  
 function ajax_sourch_submit()
 {	 	 	 
	 	$("#activity_quan").show();
        page += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/collect_activity/is_ajax/1/p/"+page,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#activity_quan").hide();
				if($.trim(data) == ''){
					$('.activity_more').hide();
				}else{
				    $("#collect_activity").append(data);
				}
			}
		}); 
 } 
 

 //取消收藏

  function ajax_sourchMake_submit()
 {	 	 	 
	 	$("#make_quan").show();
        page += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/collect_make/is_ajax/1/p/"+page,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#make_quan").hide();
				if($.trim(data) == ''){
					$('.make_more').hide();
				}else{
				    $("#collect_make").append(data);
				}
			}
		}); 
 }
 

 $(document).on('click','.confirm-ok', function () {
	 //alert($(this).parents('.user_order_card').attr('cl'));
	 //return false;
	 that = $(this);
	 var collect_id = $(this).attr('collect_id');
	 Zepto.confirm('你确定要取消关注吗?', function () {
		 cancel_collect(collect_id, that);
     });
 });
  
 $(document).on('click','.cancel', function () {
	 that = $(this);
	 var collect_id = $(this).attr('collect_id');
	 Zepto.confirm('你确定要取消关注吗?', function () {
		 cancel_make(collect_id, that);
     });
 });
 
 //异步发送
 function cancel_collect(collect_id, that){
	 $.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/cancel_collect/collect_id/"+collect_id,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data){
				if(data.status == 1){
					Zepto.alert(''+data.message+'');
					that.parents('.user_order_card').remove();
				}else{
					Zepto.alert(''+data.message+'');
				}
			}
		}); 
 }
  
 function cancel_make(collect_id, that){
	 $.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Users/cancel_make/collect_id/"+collect_id,//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data){
				if(data.status == 1){
					Zepto.alert(''+data.message+'');
					that.parents('.user_order_card').remove();
				}else{
					Zepto.alert(''+data.message+'');
				}
			}
		}); 
 }
 </script>